﻿#region itdc

/************************************************************************
*Copyright(C) 2015 by qsgy
 *All rights reserved. 
 *FileName:     $safeitemname$
 *Author:       oyh
 *Version:      
 *UnityVersion：
 *Date:   $time$      
 *Description:    
 *History: 
************************************************************************/
#endregion
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 基类
/// 订阅entity的death
/// 执行OnDeath方法
/// </summary>
[RequireComponent(typeof(Entity))]
public abstract class OnEntityDeath : MonoBehaviour {
    /// <summary>
    /// 注册entity的死亡方法
    /// </summary>
    public abstract void OnDeath();

    void Awake()
    {
        transform.GetComponent<Entity>().OnDeath += OnDeath;
    }
}
